Conditions | 9 |
Paths | 6 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | /* |
||
11 | export const stateGetter = (state, props, key, entry) => { |
||
12 | |||
13 | if (props && props.reducerKeys) { |
||
14 | if (typeof props.reducerKeys === 'string' && |
||
15 | props.reducerKeys.length > 0) { |
||
16 | |||
17 | return get(state[props.reducerKeys], key, entry); |
||
18 | |||
19 | } |
||
20 | else if (typeof props.reducerKeys === 'object' && |
||
21 | Object.keys(props.reducerKeys).length > 0 && |
||
22 | props.reducerKeys[key]) { |
||
23 | |||
24 | const dynamicKey = props.reducerKeys[key]; |
||
25 | const dynamicState = get(state, dynamicKey, entry); |
||
26 | |||
27 | return dynamicState; |
||
28 | } |
||
29 | } |
||
30 | |||
31 | const val = get(state, key, entry); |
||
32 | |||
33 | if (val) { |
||
34 | return val; |
||
35 | } |
||
36 | |||
37 | return null; |
||
38 | }; |
||
39 | |||
57 |